<template>
	<view class="body">
		<view class="title-group">
			<view class="title">选择你的性别</view>
			<view class="title-desc">为你推荐最优质的的异性</view>
		</view>

		<view class="grnder-goup">
			<view class="tab" @tap="select(1)">
				<image src="../../static/gender/man.png" mode="aspectFill"></image>
				<view :class="[gender === 1 ? 'active' : '']" class="tab-gender">
					<view class="icon iconfont icon-nan"></view>
					<view class="font">男生</view>
				</view>
			</view>
			<view class="tab" @tap="select(0)">
				<image src="../../static/gender/woman.png" mode="aspectFill"></image>
				<view :class="[gender === 0 ? 'active' : '']" class="tab-gender">
					<view class="icon iconfont icon-nv"></view>
					<view class="font">女生</view>
				</view>
			</view>
		</view>
		<view class="notic">注意：注册成功后性别后无法修改</view>
		<view class="button" @tap="userInit">确定</view>
	</view>
</template>

<script>
import showToast from '../../utils/ToastUtils.js';	
export default {
	data() {
		return {
			gender: null
		};
	},
	methods: {
		select(gender) {
			this.gender = gender;
		},
		userInit(){
			if(this.gender){
				uni.navigateTo({
					url:`../user-init/user-init?gender=${this.gender}`
				})
			}else{
				showToast("请先选择性别");
			}
		}
	},
	onBackPress(options) {
	    // return true 表示禁止默认返回
	   return true;
	},
};
</script>

<style lang="less" scoped>
.body {
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	border-top: 1rpx solid translate;
	.title-group {
		margin: 150rpx 0;
		.title {
			text-align: center;
			font-size: 40rpx;
			font-weight: 700;
			color: #333333;
			margin: 30rpx 0;
		}
		.title-desc {
			text-align: center;
			font-size: 34rpx;
			color: #999999;
		}
	}

	.grnder-goup {
		width: 100%;
		display: flex;
		flex-direction: row;
		justify-content: space-around;
		align-items: center;
		.tab {
			background-color: #ffffff;
			box-shadow: 0px 8rpx 16rpx 0px rgba(0, 0, 0, 0.1);
			border-radius: 15rpx;
			display: flex;
			flex-direction: column;
			justify-content: center;
			align-items: center;
			image {
				vertical-align: middle;
				margin: 20rpx 20rpx 0;
				width: 230rpx;
				height: 230rpx;
			}

			.tab-gender {
				display: flex;
				flex-direction: row;
				align-items: center;
				margin-bottom: 20rpx;
				.font {
					font-size: 32rpx;
					color: #333333;
				}
				.icon-nv::before {
					margin-right: 15rpx;
					background-color: #cccccc;
					color: #ffffff;
					font-size: 22rpx;
					border-radius: 50%;
					padding: 10rpx;
				}
				.icon-nan::before {
					margin-right: 15rpx;
					background-color: #cccccc;
					color: #ffffff;
					font-size: 22rpx;
					border-radius: 50%;
					padding: 10rpx;
				}
			}

			.active {
				.icon-nv::before {
					background-color: #ff8cc0;
				}
				.icon-nan::before {
					background-color: #7085ff;
				}
			}
		}
	}

	.notic {
		margin-top: 100rpx;
		color: #999999;
		font-size: 26rpx;
	}

	.button {
		position: fixed;
		bottom: 20%;
		text-align: center;
		height: 90rpx;
		line-height: 90rpx;
		border-radius: 30rpx;
		width: 75%;
		background: linear-gradient(270deg, #fc80a4 0%, #feb7ba 100%);
		color: #FFFFFF;
		font-size: 38rpx;
		font-weight: 500;
	}
}
</style>
